﻿using CommonLibrary.WFFile;
using DemountCIM.Framework;
using System.Configuration;
using System.Data;
using System.Windows;

namespace DemountCIM
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {

        public App()
        {
            ChangeLanguageService.OnChangeLanguage += Service_OnChangeLanguage;

        }
        void Service_OnChangeLanguage(SysDef.LanguagePack language, ref ResourceDictionary languageDictionary)
        {
            if (language == SysDef.LanguagePack.Chinese)
            {
                var uri = new Uri("Assets/Language/Chinese.xaml", UriKind.Relative);
                Resources.MergedDictionaries[0].Source = uri;
            }
            else if (language == SysDef.LanguagePack.English)
            {
                var uri = new Uri("Assets/Language/English.xaml", UriKind.Relative);
                Resources.MergedDictionaries[0].Source = uri;
            }
            languageDictionary = Resources.MergedDictionaries[0];
        }
    }

}
